#include "List.h"

#include <string.h>
#include <fan-llvm/core/Core.h>
#include "Type.h"
#include "UnsupportedErr.h"


Type* List_classType = NULL;
VTable* List_classVTable = NULL;


/**********************************************
 *
 * Methods and fields
 *
 **********************************************/


/* Void make(Type of, Int capacity) */
void List_make(List* self, Type* of, Int capacity)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.make not implemented yet"));
}


/* Void makeObj(Int capacity) */
void List_makeObj(List* self, Int capacity)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.makeObj not implemented yet"));
}


/* Bool equals(Obj? that) */
Bool List_equals(Obj self, NullableObj that)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.equals not implemented yet"));
}


/* Int hash() */
Int List_hash(Obj self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.hash not implemented yet"));
}


/* Str toStr() */
Str* List_toStr(Obj self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.toStr not implemented yet"));
}


/* Int size */
Int List_size(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.size not implemented yet"));
}


/* Int size */
void List_setSize(List* self, Int val)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.size not implemented yet"));
}


/* Int capacity */
Int List_capacity(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.capacity not implemented yet"));
}


/* Int capacity */
void List_setCapacity(List* self, Int val)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.capacity not implemented yet"));
}


/* Type of() */
Type* List_of(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.of not implemented yet"));
}


/* Bool isEmpty() */
Bool List_isEmpty(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.isEmpty not implemented yet"));
}


/* V get(Int index) */
Val List_get(List* self, Int index)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.get not implemented yet"));
}


/* V? getSafe(Int index, V? def) */
Val List_getSafe_1(List* self, Int index)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.getSafe not implemented yet"));
}


/* V? getSafe(Int index, V? def) */
Val List_getSafe(List* self, Int index, Val def)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.getSafe not implemented yet"));
}


/* L getRange(Range range) */
List* List_getRange(List* self, Range* range)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.getRange not implemented yet"));
}


/* Bool contains(V item) */
Bool List_contains(List* self, Val item)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.contains not implemented yet"));
}


/* Bool containsAll(L list) */
Bool List_containsAll(List* self, List* list)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.containsAll not implemented yet"));
}


/* Bool containsAny(L list) */
Bool List_containsAny(List* self, List* list)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.containsAny not implemented yet"));
}


/* Int? index(V item, Int offset) */
NullableInt List_index_1(List* self, Val item)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.index not implemented yet"));
}


/* Int? index(V item, Int offset) */
NullableInt List_index(List* self, Val item, Int offset)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.index not implemented yet"));
}


/* Int? indexSame(V item, Int offset) */
NullableInt List_indexSame_1(List* self, Val item)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.indexSame not implemented yet"));
}


/* Int? indexSame(V item, Int offset) */
NullableInt List_indexSame(List* self, Val item, Int offset)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.indexSame not implemented yet"));
}


/* V? first() */
Val List_first(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.first not implemented yet"));
}


/* V? last() */
Val List_last(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.last not implemented yet"));
}


/* L dup() */
List* List_dup(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.dup not implemented yet"));
}


/* L set(Int index, V item) */
List* List_set(List* self, Int index, Val item)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.set not implemented yet"));
}


/* L add(V item) */
List* List_add(List* self, Val item)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.add not implemented yet"));
}


/* L addAll(L list) */
List* List_addAll(List* self, List* list)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.addAll not implemented yet"));
}


/* L insert(Int index, V item) */
List* List_insert(List* self, Int index, Val item)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.insert not implemented yet"));
}


/* L insertAll(Int index, L list) */
List* List_insertAll(List* self, Int index, List* list)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.insertAll not implemented yet"));
}


/* V? remove(V item) */
Val List_remove(List* self, Val item)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.remove not implemented yet"));
}


/* V? removeSame(V item) */
Val List_removeSame(List* self, Val item)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.removeSame not implemented yet"));
}


/* V removeAt(Int index) */
Val List_removeAt(List* self, Int index)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.removeAt not implemented yet"));
}


/* L removeRange(Range r) */
List* List_removeRange(List* self, Range* r)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.removeRange not implemented yet"));
}


/* L clear() */
List* List_clear(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.clear not implemented yet"));
}


/* L trim() */
List* List_trim(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.trim not implemented yet"));
}


/* L fill(V val, Int times) */
List* List_fill(List* self, Val val, Int times)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.fill not implemented yet"));
}


/* V? peek() */
Val List_peek(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.peek not implemented yet"));
}


/* V? pop() */
Val List_pop(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.pop not implemented yet"));
}


/* L push(V item) */
List* List_push(List* self, Val item)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.push not implemented yet"));
}


/* Void each(|V,Int->Void| c) */
void List_each(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.each not implemented yet"));
}


/* Void eachr(|V,Int->Void| c) */
void List_eachr(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.eachr not implemented yet"));
}


/* Void eachRange(Range r, |V,Int->Void| c) */
void List_eachRange(List* self, Range* r, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.eachRange not implemented yet"));
}


/* Obj? eachWhile(|V,Int->Obj?| c) */
NullableObj List_eachWhile(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.eachWhile not implemented yet"));
}


/* Obj? eachrWhile(|V,Int->Obj?| c) */
NullableObj List_eachrWhile(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.eachrWhile not implemented yet"));
}


/* V? find(|V,Int->Bool| c) */
Val List_find(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.find not implemented yet"));
}


/* Int? findIndex(|V,Int->Bool| c) */
NullableInt List_findIndex(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.findIndex not implemented yet"));
}


/* L findAll(|V,Int->Bool| c) */
List* List_findAll(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.findAll not implemented yet"));
}


/* L findType(Type t) */
List* List_findType(List* self, Type* t)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.findType not implemented yet"));
}


/* L exclude(|V,Int->Bool| c) */
List* List_exclude(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.exclude not implemented yet"));
}


/* Bool any(|V,Int->Bool| c) */
Bool List_any(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.any not implemented yet"));
}


/* Bool all(|V,Int->Bool| c) */
Bool List_all(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.all not implemented yet"));
}


/* Obj?[] map(|V,Int->Obj?| c) */
List* List_map(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.map not implemented yet"));
}


/* Obj? reduce(Obj? init, |Obj?,V,Int->Obj?| c) */
NullableObj List_reduce(List* self, NullableObj init, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.reduce not implemented yet"));
}


/* V? min(|V,V->Int|? c) */
Val List_min_0(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.min not implemented yet"));
}


/* V? min(|V,V->Int|? c) */
Val List_min(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.min not implemented yet"));
}


/* V? max(|V,V->Int|? c) */
Val List_max_0(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.max not implemented yet"));
}


/* V? max(|V,V->Int|? c) */
Val List_max(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.max not implemented yet"));
}


/* L unique() */
List* List_unique(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.unique not implemented yet"));
}


/* L union(L that) */
List* List_union(List* self, List* that)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.union not implemented yet"));
}


/* L intersection(L that) */
List* List_intersection(List* self, List* that)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.intersection not implemented yet"));
}


/* L sort(|V,V->Int|? c) */
List* List_sort_0(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.sort not implemented yet"));
}


/* L sort(|V,V->Int|? c) */
List* List_sort(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.sort not implemented yet"));
}


/* L sortr(|V,V->Int|? c) */
List* List_sortr_0(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.sortr not implemented yet"));
}


/* L sortr(|V,V->Int|? c) */
List* List_sortr(List* self, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.sortr not implemented yet"));
}


/* Int binarySearch(V key, |V,V->Int|? c) */
Int List_binarySearch_1(List* self, Val key)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.binarySearch not implemented yet"));
}


/* Int binarySearch(V key, |V,V->Int|? c) */
Int List_binarySearch(List* self, Val key, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.binarySearch not implemented yet"));
}


/* L reverse() */
List* List_reverse(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.reverse not implemented yet"));
}


/* L swap(Int indexA, Int indexB) */
List* List_swap(List* self, Int indexA, Int indexB)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.swap not implemented yet"));
}


/* L moveTo(V item, Int toIndex) */
List* List_moveTo(List* self, Val item, Int toIndex)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.moveTo not implemented yet"));
}


/* Obj?[] flatten() */
List* List_flatten(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.flatten not implemented yet"));
}


/* V? random() */
Val List_random(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.random not implemented yet"));
}


/* L shuffle() */
List* List_shuffle(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.shuffle not implemented yet"));
}


/* Str join(Str separator, |V,Int->Str|? c) */
Str* List_join_0(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.join not implemented yet"));
}


/* Str join(Str separator, |V,Int->Str|? c) */
Str* List_join_1(List* self, Str* separator)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.join not implemented yet"));
}


/* Str join(Str separator, |V,Int->Str|? c) */
Str* List_join(List* self, Str* separator, Func* c)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.join not implemented yet"));
}


/* Str toCode() */
Str* List_toCode(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.toCode not implemented yet"));
}


/* Bool isRO() */
Bool List_isRO(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.isRO not implemented yet"));
}


/* Bool isRW() */
Bool List_isRW(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.isRW not implemented yet"));
}


/* L ro() */
List* List_ro(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.ro not implemented yet"));
}


/* L rw() */
List* List_rw(List* self)
{
  exceptionThrow(UnsupportedErr_newWithFormattedMsg("sys::List.rw not implemented yet"));
}


/**********************************************
 *
 * Type-system functions
 *
 **********************************************/


Type* List_initType(void)
{
  if (List_classType == NULL)
  {
    Type* baseType = Obj_initType();
    VTable* vtable = List_initVTable();
    Type* type = Type_new("List", baseType, vtable, sizeof(List), sizeof(ListVTable));
    Type_registerCtorImplementation(type, "make", List_make, 2);
    Type_registerCtorImplementation(type, "makeObj", List_makeObj, 1);
    Type_registerMethodImplementation(type, "add", List_add, 1);
    Type_registerMethodImplementation(type, "addAll", List_addAll, 1);
    Type_registerMethodImplementation(type, "all", List_all, 1);
    Type_registerMethodImplementation(type, "any", List_any, 1);
    Type_registerMethodImplementation(type, "binarySearch", List_binarySearch_1, 1);
    Type_registerMethodImplementation(type, "binarySearch", List_binarySearch, 2);
    Type_registerMethodImplementation(type, "clear", List_clear, 0);
    Type_registerMethodImplementation(type, "contains", List_contains, 1);
    Type_registerMethodImplementation(type, "containsAll", List_containsAll, 1);
    Type_registerMethodImplementation(type, "containsAny", List_containsAny, 1);
    Type_registerMethodImplementation(type, "dup", List_dup, 0);
    Type_registerMethodImplementation(type, "each", List_each, 1);
    Type_registerMethodImplementation(type, "eachRange", List_eachRange, 2);
    Type_registerMethodImplementation(type, "eachWhile", List_eachWhile, 1);
    Type_registerMethodImplementation(type, "eachr", List_eachr, 1);
    Type_registerMethodImplementation(type, "eachrWhile", List_eachrWhile, 1);
    Type_registerMethodImplementation(type, "equals", List_equals, 1);
    Type_registerMethodImplementation(type, "exclude", List_exclude, 1);
    Type_registerMethodImplementation(type, "fill", List_fill, 2);
    Type_registerMethodImplementation(type, "find", List_find, 1);
    Type_registerMethodImplementation(type, "findAll", List_findAll, 1);
    Type_registerMethodImplementation(type, "findIndex", List_findIndex, 1);
    Type_registerMethodImplementation(type, "findType", List_findType, 1);
    Type_registerMethodImplementation(type, "first", List_first, 0);
    Type_registerMethodImplementation(type, "flatten", List_flatten, 0);
    Type_registerMethodImplementation(type, "get", List_get, 1);
    Type_registerMethodImplementation(type, "getRange", List_getRange, 1);
    Type_registerMethodImplementation(type, "getSafe", List_getSafe_1, 1);
    Type_registerMethodImplementation(type, "getSafe", List_getSafe, 2);
    Type_registerMethodImplementation(type, "hash", List_hash, 0);
    Type_registerMethodImplementation(type, "index", List_index_1, 1);
    Type_registerMethodImplementation(type, "index", List_index, 2);
    Type_registerMethodImplementation(type, "indexSame", List_indexSame_1, 1);
    Type_registerMethodImplementation(type, "indexSame", List_indexSame, 2);
    Type_registerMethodImplementation(type, "insert", List_insert, 2);
    Type_registerMethodImplementation(type, "insertAll", List_insertAll, 2);
    Type_registerMethodImplementation(type, "intersection", List_intersection, 1);
    Type_registerMethodImplementation(type, "isEmpty", List_isEmpty, 0);
    Type_registerMethodImplementation(type, "isRO", List_isRO, 0);
    Type_registerMethodImplementation(type, "isRW", List_isRW, 0);
    Type_registerMethodImplementation(type, "join", List_join_0, 0);
    Type_registerMethodImplementation(type, "join", List_join_1, 1);
    Type_registerMethodImplementation(type, "join", List_join, 2);
    Type_registerMethodImplementation(type, "last", List_last, 0);
    Type_registerMethodImplementation(type, "map", List_map, 1);
    Type_registerMethodImplementation(type, "max", List_max_0, 0);
    Type_registerMethodImplementation(type, "max", List_max, 1);
    Type_registerMethodImplementation(type, "min", List_min_0, 0);
    Type_registerMethodImplementation(type, "min", List_min, 1);
    Type_registerMethodImplementation(type, "moveTo", List_moveTo, 2);
    Type_registerMethodImplementation(type, "of", List_of, 0);
    Type_registerMethodImplementation(type, "peek", List_peek, 0);
    Type_registerMethodImplementation(type, "pop", List_pop, 0);
    Type_registerMethodImplementation(type, "push", List_push, 1);
    Type_registerMethodImplementation(type, "random", List_random, 0);
    Type_registerMethodImplementation(type, "reduce", List_reduce, 2);
    Type_registerMethodImplementation(type, "remove", List_remove, 1);
    Type_registerMethodImplementation(type, "removeAt", List_removeAt, 1);
    Type_registerMethodImplementation(type, "removeRange", List_removeRange, 1);
    Type_registerMethodImplementation(type, "removeSame", List_removeSame, 1);
    Type_registerMethodImplementation(type, "reverse", List_reverse, 0);
    Type_registerMethodImplementation(type, "ro", List_ro, 0);
    Type_registerMethodImplementation(type, "rw", List_rw, 0);
    Type_registerMethodImplementation(type, "set", List_set, 2);
    Type_registerMethodImplementation(type, "shuffle", List_shuffle, 0);
    Type_registerMethodImplementation(type, "sort", List_sort_0, 0);
    Type_registerMethodImplementation(type, "sort", List_sort, 1);
    Type_registerMethodImplementation(type, "sortr", List_sortr_0, 0);
    Type_registerMethodImplementation(type, "sortr", List_sortr, 1);
    Type_registerMethodImplementation(type, "swap", List_swap, 2);
    Type_registerMethodImplementation(type, "toCode", List_toCode, 0);
    Type_registerMethodImplementation(type, "toStr", List_toStr, 0);
    Type_registerMethodImplementation(type, "trim", List_trim, 0);
    Type_registerMethodImplementation(type, "union", List_union, 1);
    Type_registerMethodImplementation(type, "unique", List_unique, 0);
    Type_registerFieldImplementation(type, "capacity", List_capacity, List_setCapacity);
    Type_registerFieldImplementation(type, "size", List_size, List_setSize);
    List_classType = type;
    List_initStatic();
  }
  return List_classType;
}


VTable* List_initVTable(void)
{
  if (List_classVTable == NULL)
  {
    VTable* vtable = memoryAlloc(sizeof(ListVTable));
    memcpy(vtable, Obj_initVTable(), sizeof(FanObjVTable));
    ((FanObjVTable*)vtable)->equals = List_equals;
    ((FanObjVTable*)vtable)->hash = List_hash;
    ((FanObjVTable*)vtable)->toStr = List_toStr;
    List_classVTable = vtable;
  }
  return List_classVTable;
}


void List_initStatic(void)
{
}
